package com.lixingqu.mvpdemo.ui.news;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lixingqu.mvpdemo.R;
import com.lixingqu.mvpdemo.entity.NewsEntity;

import java.util.List;

/**
 * Created by lixingqu on 2016/12/2.
 */

public class NewsAdapter extends BaseQuickAdapter<NewsEntity,BaseViewHolder>{

    public NewsAdapter(List<NewsEntity> data) {
        super(R.layout.item_news, data);
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, NewsEntity newsEntity) {
        baseViewHolder.setText(R.id.tv_item_news_title,newsEntity.getCtime())
                .setText(R.id.tv_item_news_description,newsEntity.getTitle());
        Glide.with(mContext).load(newsEntity.getPicUrl()).crossFade().into((ImageView) baseViewHolder.getView(R.id.iv_item_news_pic));
    }
}
